<?php
namespace app\commands;
use Yii;
use yii\console\Controller;

/**
 * This command echoes the first argument that you have entered.
 *
 * This command is provided as an example for you to learn how to create console commands.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class GetBaiduDataController extends Controller
{
    /**
     * This command echoes what you have entered as the message.
     * @param string $message the message to be echoed.
     */
    public function actionIndex()
    {
        $url = "http://zhaopin.baidu.com/api/async?query=%E5%B9%B6%E8%B4%AD&salary=10000_14999&city=%E5%8C%97%E4%BA%AC&date=20151110_20151111";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_ENCODING, "gzip" );
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        $output = curl_exec($ch);
        $dataChange = json_decode($output);
        curl_close($ch);
        var_dump($dataChange->data->data->listNum);
    }


}

